<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="avicit.platform6.commons.utils.ViewUtil" %>
<%@ page import="avicit.platform6.commons.utils.ComUtil" %>
<%@ taglib prefix="sec" uri="/WEB-INF/tags/shiro.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL" %>
<%@page import="java.util.Locale" %>
<%@page import="avicit.platform6.api.session.SessionHelper" %>
<%@page import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess" %>
<%
    Object lang = session.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
    String languageCode = "zh_CN";
    if (lang != null) {
        languageCode = lang.toString();
    }
    Locale locale = SessionHelper.getLocaleByUser(request);
%>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <base href="<%=ViewUtil.getRequestPath(request)%>">
    <jsp:include page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
    <jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
    <script type="text/javascript" src="avicit/platform6/bpmconsole/js/funsionCharts/FusionCharts.js"></script>
    <script src="static/js/platform/component/common/exportData.js" type="text/javascript"></script>
    <jsp:include page="/avicit/platform6/modules/system/commonpopup/commonSelectionHead.jsp"></jsp:include>
    <script type="text/javascript"
            src="avicit/im/lantop/basic/reportmanager/locale/language_<%=languageCode%>.js"></script>
    <script type="text/javascript" src="avicit/im/lantop/basic/reportmanager/js/ReportManager.js"></script>
    <script type="text/javascript" src="avicit/im/lantop/basic/reportmanager/js/LantopFineReport.js"></script>
    <link href="static/css/custom/lantop/css/custom.css" type="text/css"  rel="stylesheet">
    <title>报表管理</title>
    <script type="text/javascript">
        var baseHref = '<%=ViewUtil.getRequestPath(request)%>';
        var iframeHeight = document.documentElement.clientHeight;
        var reportManager;
        var lantopFineReport;
        var orgId = "${orgId}";
        $(function () {
            reportManager = new ReportManager('${url}', '${sysId}',
                'reportTree', 'reportTreeRoot', '<%=PlatformLocalesJSTL.getBundleValue("lantop.remind","i18n.lantop",locale)%>', '<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.loadReportTree.templatenotexist","i18n.lantop",locale)%>', '<%=PlatformLocalesJSTL.getBundleValue("lantop.save.success","i18n.lantop",locale)%>', '<%=PlatformLocalesJSTL.getBundleValue("lantop.save.failure","i18n.lantop",locale)%>', '<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.init.choosedatasource","i18n.lantop",locale)%>', '<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.init.determine","i18n.lantop",locale)%>', '<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.init.setdatsource","i18n.lantop",locale)%>', '<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.init.outterdatasource","i18n.lantop",locale)%>', '<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.init.cancle","i18n.lantop",locale)%>');
            lantopFineReport = new LantopFineReport("<%=ViewUtil.getRequestPath(request)%>", {
                op: "write",
                __showtoolbar__: "false"
            }, "reportView", false);
            if (orgId != 'ORG_ROOT') {
                $('#rootTree').css('height', iframeHeight / 2 - 13);
                $('#childTree').css('height', iframeHeight / 2 - 13);
            } else {
                $('#rootTree').css('height', iframeHeight - 27);
            }
        });

        function printReport() {
            var tabelNames = "LANTOP_XMWD_WJ";
            var tableNameIds = "8a58bc5b4dffa2ee014dffa6ec2603f3";
            var sysId = "LANTOP";

            var dialogId = "printDialog";
            var printDialog = new CommonDialog(dialogId, "450", "350",
                "platform/im/lantop/basic/ReportManagerController/printreport?dialogId=" + dialogId
                + "&tableNames=" + tabelNames + "&tableNameIds=" + tableNameIds
                + "&sysId=" + sysId
                , commonLang.tip.printReport, false, true, false, false, true);
            printDialog.show();
        }
    </script>
    <style>
        a.l-btn-plain {
            height: 25px;
        }
    </style>
<body class="easyui-layout" data-options="fit:true">
<!-- 新建模板，选择数据源对话框 -->
<%--选择数据源 --%>
<div id="dataSourceSelectDialog" class="easyui-dialog"
     title="<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.choosedatasource","i18n.lantop",locale)%>"
     style="width: 400px; height: 200px;" data-options="resizable:true,modal:true">
    <div>
        <table>
            <tr>
                <td><input type="radio" value="0" name="dataSourceType" checked/></td>
                <%--来源于当前数据库 --%>
                <td><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.originatefromthecurrentdatabase", "i18n.lantop", locale)%>
                </td>
            </tr>
            <tr>
                <td><input type="radio" name="dataSourceType" value="1"/></td>
                <%--用户自定义数据源 --%>
                <td><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.Userdefineddatasource", "i18n.lantop", locale)%>
                </td>
            </tr>

        </table>
    </div>
</div>
<%--分类树 --%>
<div data-options="region:'west',fit:false,title:'<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.classifyTree","i18n.lantop",locale)%>', collapsible: true"
     style="width: 250px;">
    <div id="cc" class="easyui-layout" style="width: 100%; height: 100%;">
        <div id="rootTree" style="overflow: auto;">
            <ul id="reportTreeRoot"></ul>
        </div>
        <c:if test="${orgId != 'ORG_ROOT'}">
            <div id="childTree" style="overflow: auto;">
                <ul id="reportTree"></ul>
            </div>
        </c:if>
    </div>
    <!--  树右键菜单定义 -->
    <div id="mm" class="easyui-menu" style="width: 120px; display: none">
        <%--新建分类 --%>
        <div onclick="reportManager.append('<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.newclassification","i18n.lantop",locale)%>')"
             data-options="iconCls:'icon-im-add'"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.newclassification", "i18n.lantop", locale)%>
        </div>
        <div class="menu-sep"></div>
        <%--新建模板 --%>
        <div onclick="reportManager.appendTemplate()"
             data-options="iconCls:'icon-im-add'"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.newtemplate", "i18n.lantop", locale)%>
        </div>
        <div class="menu-sep"></div>
        <%--删除 --%>
        <div onclick="reportManager.remove()"
             data-options="iconCls:'icon-im-remove'"><%=PlatformLocalesJSTL.getBundleValue("lantop.delete", "i18n.lantop", locale)%>
        </div>
    </div>
    <!--  树右键菜单定义, 对于模板只定义删除操作 -->
    <div id="mm1" class="easyui-menu" style="width: 120px; display: none">
        <%--删除 --%>
        <div onclick="reportManager.remove()"
             data-options="iconCls:'icon-im-remove'"><%=PlatformLocalesJSTL.getBundleValue("lantop.delete", "i18n.lantop", locale)%>
        </div>
    </div>
</div>
<div data-options="region:'center',title:'center title', noheader:true, border:false" style="padding: 0px;">
    <div id="cc" class="easyui-layout" fit="true" border="false">

        <div data-options="region:'north',title:'North Title',split:false,noheader:true,border:false"
             style="height: 35px;margin-top: 5px; overflow: hidden;" class="datagrid-toolbar">
            <%-- 报表预览 --%>
            <a class="easyui-linkbutton selbtnc" iconCls="icon-im-newreview"
               onclick="reportManager.previewReport();"
               href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.button.reportPreview", "i18n.lantop", locale)%>
            </a>
            <%-- 导入 --%>
            <a class="easyui-linkbutton selbtnc" id="importId" iconCls="icon-im-import"
               onclick="reportManager.importData();"
               href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.button.import", "i18n.lantop", locale)%>
            </a>
            <%-- 导出--%>
            <a class="easyui-linkbutton selbtnc" iconCls="icon-im-export" onclick="reportManager.exportData();"
               href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.button.export", "i18n.lantop", locale)%>
            </a>

            <%-- 报表配置--%>
            <a class="easyui-linkbutton selbtnc" iconCls="icon-im-edit" onclick="reportManager.configReport();"
               href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.button.reportConfiguration", "i18n.lantop", locale)%>
            </a>

            <%-- 高级配置 --%>
            <a class="easyui-linkbutton selbtnc" iconCls="icon-im-edit" onclick="reportManager.configuration();"
               href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.reportformconfig.configuration", "i18n.lantop", locale)%>
            </a>
        </div>

        <div data-options="region:'center',title:'center title', noheader:true,border:false"
             style="padding-top: 10px; padding-bottom: 10px; overflow: hidden; margin: 0px">
            <iframe id="reportView" name="reportView" width="100%" height="100%" frameborder="0"></iframe>
        </div>
    </div>


</div>
</body>
</html>